home *** CD-ROM | disk | FTP | other *** search
- /*====================================================================================================
- File: WFILES.H
-
- Copyright (C) 1994-1995 Apple Computer, Inc. All rights reserved.
-
- Description:
-
- Windows equivalent of the Macintosh include files "Files.h" and
- "Aliases.h".
-
- Change History:
-
- Date By Description
- ---- -- -----------
- 03/24/94 SW ParamBlockRec - typedef added.
- ====================================================================================================*/
-
- #if !defined(__FILES__) || !defined(FILES_H) || !defined(WFILES_H)
- #define __FILES__
- #define FILES_H
- #define WFILES_H
-
- #if defined(WINDOWS) // this file is only included for windows client
-
-
- //====================================================================================================
- // Dependencies
- //====================================================================================================
-
- #ifndef TYPES_H // OSErr, OSType, ScriptCode, Byte, etc.
- #include "wtypes.h"
- #endif // TYPES_H
-
-
-
-
- //==============================================================================
- // Constants
- //==============================================================================
-
- //
- // dos constants
- //
- #define MAX_NESTED_DIRECTORIES 15 // (67 (tot path len) - 13 (file nm len)
- // - 15 back slashes) / 15 (nest dir
- // val = 2+ chars in avg dir nm len
- #define DOS_FILE_NM_BUFF_SZ 13 // 8 . 3 + 1 for \0
- #define NT_MAX_PATH_LEN 256 // as of Dos 6.2, only 67 chars, but
- // this will be the compromise in
- // anticipation of NT .. actually
- // a theoretically un-limited len
- // is possible with NT (oh my!)
-
- //
- // constants from files.h
- //
-
- // Values passed to SetFPos() via its <offset> argument.
- // #define fsAtMark 0 // mac value is 0
- #define fsFromStart 0 // " 1
- #define fsFromLEOF 2 // " 2
- #define fsFromMark 1 // " 3
-
- // Values passed to FSpOpenDF() via it's <permission> argument.
- #define fsCurPerm 0
- #define fsRdPerm 1
- #define fsWrPerm 2
- #define fsRdWrPerm 3
- #define fsRdWrShPerm 4
-
- //
- // constants from aliases.h
- //
-
- // define alias resolution action rules mask
- #define kARMMountVol 0x00000001L // mount the volume automatically
- #define kARMNoUI 0x00000002L // no user interface allowed during resolution
- #define kARMMultVols 0x00000008L // search on multiple volumes
- #define kARMSearch 0x00000100L // search quickly
- #define kARMSearchMore 0x00000200L // search further
- #define kARMSearchRelFirst 0x00000400L // search target on a relative path first
-
- // define alias record information types
- #define asiZoneName -3 // get zone name *
- #define asiServerName -2 // get server name
- #define asiVolumeName -1 // get volume name
- #define asiAliasName 0 // get aliased file/folder/volume name
- #define asiParentName 1 // get parent folder name
-
-
- //==============================================================================
- // Type Definitions
- //==============================================================================
-
- //
- // type definitions from files.h
- //
- typedef unsigned char CInfoType;
-
-
- struct FInfo {
- OSType fdType; /*the type of the file*/
- OSType fdCreator; /*file's creator*/
- unsigned short fdFlags; /*flags ex. hasbundle,invisible,locked, etc.*/
- Point fdLocation; /*file's location in folder*/
- short fdFldr; /*folder containing file*/
- };
-
- typedef struct FInfo FInfo;
-
- struct FXInfo {
- short fdIconID; /*Icon ID*/
- short fdUnused[3]; /*unused but reserved 6 bytes*/
- char fdScript; /*Script flag and number*/
- char fdXFlags; /*More flag bits*/
- short fdComment; /*Comment ID*/
- long fdPutAway; /*Home Dir ID*/
- };
-
- typedef struct FXInfo FXInfo;
-
- struct DInfo {
- Rect frRect; /*folder rect*/
- unsigned short frFlags; /*Flags*/
- Point frLocation; /*folder location*/
- short frView; /*folder view*/
- };
-
- typedef struct DInfo DInfo;
-
- struct DXInfo {
- Point frScroll; /*scroll position*/
- long frOpenChain; /*DirID chain of open folders*/
- char frScript; /*Script flag and number*/
- char frXFlags; /*More flag bits*/
- short frComment; /*comment*/
- long frPutAway; /*DirID*/
- };
-
- typedef struct DXInfo DXInfo;
-
-
- // All FSSpec references have been changed to a c string (char*)
- typedef struct FSSpec
- {
- short vRefNum;
- long parID;
- char name[64];
- } FSSpec, *FSSpecPtr, *FSSpecArrayPtr ;
-
-
-
- typedef void* QElemPtr;
-
- #define ParamBlockHeader \
- QElemPtr qLink; /*queue link in header*/ \
- short qType; /*type byte for safety check*/ \
- short ioTrap; /*FS: the Trap*/ \
- Ptr ioCmdAddr; /*FS: address to dispatch to*/ \
- ProcPtr ioCompletion; /*completion routine addr (0 for synch calls)*/ \
- OSErr ioResult; /*result code*/ \
- StringPtr ioNamePtr; /*ptr to Vol:FileName string*/ \
- short ioVRefNum; /*volume refnum (DrvNum for Eject and MountVol)*/
-
- struct IOParam
- {
- ParamBlockHeader
- short ioRefNum; //refNum for I/O operation
- char ioVersNum; //version number
- char ioPermssn; //Open: permissions (byte)
- Ptr ioMisc; //Rename: new name (GetEOF,SetEOF: logical
- //end of file) (Open: optional ptr to buffer)
- //(SetFileType: new type)
- Ptr ioBuffer; //data buffer Ptr
- long ioReqCount; //requested byte count; also = ioNewDirID
- long ioActCount; //actual byte count completed
- short ioPosMode; //initial file positioning
- long ioPosOffset; //file position offset
- };
-
- typedef struct IOParam IOParam;
-
- struct FileParam
- {
- ParamBlockHeader
- short ioFRefNum; // reference number
- char ioFVersNum; // version number
- char filler1; //
- short ioFDirIndex; // GetFInfo directory index
- unsigned char ioFlAttrib; // GetFInfo: in-use bit=7, lock bit=0
- unsigned char ioFlVersNum; // file version number
- FInfo ioFlFndrInfo; // user info
- unsigned long ioFlNum; // GetFInfo: file number; TF- ioDirID
- unsigned short ioFlStBlk; // start file block (0 if none)
- long ioFlLgLen; // logical length (EOF)
- long ioFlPyLen; // physical length
- unsigned short ioFlRStBlk; // start block rsrc fork
- long ioFlRLgLen; // file logical length rsrc fork
- long ioFlRPyLen; // file physical length rsrc fork
- unsigned long ioFlCrDat; // file creation date& time (32 bits in secs)
- unsigned long ioFlMdDat; // last modified date and time
- };
-
- typedef struct FileParam FileParam;
-
- // 3/9/95 The precision of ioVFrBlk & ioVNmAlBlks have been changed for the
- // Windows version to a long to support the volume space calculation done
- // based upon DOS. Free blocks are organized by clusters of 512 k blocks in the
- // typical dos environment. There can be so many that multiplying the
- // cluster count by the cluster factor will overflow an unsigned short.
-
- struct VolumeParam
- {
- ParamBlockHeader
- long filler2;
- short ioVolIndex; // volume index number
- unsigned long ioVCrDate; // creation date and time
- unsigned long ioVLsBkUp; // last backup date and time
- unsigned short ioVAtrb; // volume attrib
- unsigned short ioVNmFls; // number of files in directory
- unsigned short ioVDirSt; // start block of file directory
- short ioVBlLn; // GetVolInfo: length of dir in blocks
- #if 0
- unsigned short ioVNmAlBlks; // GetVolInfo: num blks (of alloc size)
- #endif
- unsigned long ioVNmAlBlks; // GetVolInfo: num blks (of alloc size)
- long ioVAlBlkSiz; // GetVolInfo: alloc blk byte size
- long ioVClpSiz; // GetVolInfo: bytes to allocate at a time
- unsigned short ioAlBlSt; // starting disk(512-byte) block in block map
- unsigned long ioVNxtFNum; // GetVolInfo: next free file number
- #if 0
- unsigned short ioVFrBlk; // GetVolInfo: # free alloc blks for this vol
- #endif
- unsigned long ioVFrBlk; // GetVolInfo: # free alloc blks for this vol
- };
-
- typedef struct VolumeParam VolumeParam;
-
- typedef Byte CntrlParam[50];
- typedef Byte SlotDevParam[36];
- typedef Byte MultiDevParam[38];
-
- typedef union ParamBlockRec
- {
- IOParam ioParam;
- FileParam fileParam;
- VolumeParam volumeParam;
- CntrlParam cntrlParam;
- SlotDevParam slotDevParam;
- MultiDevParam multiDevParam;
- } ParamBlockRec;
-
- typedef ParamBlockRec* ParmBlkPtr;
-
- struct HFileInfo {
- ParamBlockHeader
- short ioFRefNum;
- char ioFVersNum;
- char filler1;
- short ioFDirIndex;
- char ioFlAttrib;
- char filler2;
- FInfo ioFlFndrInfo;
- long ioDirID;
- unsigned short ioFlStBlk;
- long ioFlLgLen;
- long ioFlPyLen;
- unsigned short ioFlRStBlk;
- long ioFlRLgLen;
- long ioFlRPyLen;
- unsigned long ioFlCrDat;
- unsigned long ioFlMdDat;
- unsigned long ioFlBkDat;
- FXInfo ioFlXFndrInfo;
- long ioFlParID;
- long ioFlClpSiz;
- };
-
- typedef struct HFileInfo HFileInfo;
-
- struct DirInfo {
- ParamBlockHeader
- short ioFRefNum;
- short filler1;
- short ioFDirIndex;
- char ioFlAttrib;
- char filler2;
- DInfo ioDrUsrWds;
- long ioDrDirID;
- unsigned short ioDrNmFls;
- short filler3[9];
- unsigned long ioDrCrDat;
- unsigned long ioDrMdDat;
- unsigned long ioDrBkDat;
- DXInfo ioDrFndrInfo;
- long ioDrParID;
- };
-
- typedef struct DirInfo DirInfo;
-
- union CInfoPBRec {
- HFileInfo hFileInfo;
- DirInfo dirInfo;
- };
-
- typedef union CInfoPBRec CInfoPBRec;
- typedef CInfoPBRec *CInfoPBPtr;
-
- struct FCBPBRec {
- QElemPtr qLink;
- short qType;
- short ioTrap;
- Ptr ioCmdAddr;
- ProcPtr ioCompletion;
- OSErr ioResult;
- StringPtr ioNamePtr;
- short ioVRefNum;
- short ioRefNum;
- short filler;
- short ioFCBIndx;
- short filler1;
- long ioFCBFlNm;
- short ioFCBFlags;
- unsigned short ioFCBStBlk;
- long ioFCBEOF;
- long ioFCBPLen;
- long ioFCBCrPs;
- short ioFCBVRefNum;
- long ioFCBClpSiz;
- long ioFCBParID;
- };
-
- typedef struct FCBPBRec FCBPBRec;
- typedef FCBPBRec *FCBPBPtr;
-
- //
- // type definitions from aliases.h
- //
-
- // The alias structure begins with this definition followed by aliasSize
- // bytes of private information describing the whereabouts of a file (or
- // presumably another obj)
- struct AliasRecord
- {
- OSType userType; // appl stored type like creator type
- unsigned short aliasSize; // alias record size in bytes, for appl usage
- };
-
- typedef struct AliasRecord AliasRecord;
- typedef AliasRecord *AliasPtr, **AliasHandle;
-
- typedef short AliasInfoType; /* alias record information type */
- typedef pascal Boolean (*AliasFilterProcPtr) (CInfoPBPtr cpbPtr /*I*/
- ,Boolean *quitFlag /*O*/
- ,Ptr yourDataPtr); /*I*/
-
-
-
-
- //====================================================================================================
- // Function Declarations
- //====================================================================================================
-
- #if defined __cplusplus
- extern "C" {
- #endif
- //
- // Function declarations from files.h
- //
-
- OSErr pascal FSClose(short refNum);
- OSErr pascal FSRead(short refNum, long* count, void* buffer);
- OSErr pascal FSWrite(short refNum, long* count, void* buffer);
-
- OSErr pascal GetFPos(short refNum, long* filePos);
- OSErr pascal SetFPos(short refNum, short posMode, long posOffset);
-
- OSErr pascal GetEOF(short refNum, long* logEOF);
- OSErr pascal SetEOF(short refNum, long logEOF);
-
- OSErr pascal PBGetFCBInfo(FCBPBPtr paramBlock,Boolean async);
- OSErr pascal PBGetVInfo(ParmBlkPtr paramBlock,Boolean async);
-
- #if 0
- // all FSSpec references have been changed to a char*
- OSErr pascal FSMakeFSSpec(short vRefNum,long dirID,Str255 fileStr,FSSpecPtr fileFSSpec);
- OSErr pascal FSpCreate(FSSpec* spec, OSType creator, OSType fileType, ScriptCode scriptTag);
- OSErr pascal FSpOpenDF(FSSpec* spec, char permission, short* refNum);
- #endif
- OSErr pascal FSpCreate(char* spec, OSType creator, OSType fileType, ScriptCode scriptTag);
- OSErr pascal FSpOpenDF(char* spec, char permission, short* refNum);
- OSErr pascal FSpDelete(char* spec);
-
-
- #if defined __cplusplus
- }
- #endif
-
- #endif // WINDOWS
- #endif // __FILES__
-
- //
- // $Log: /bogart/mac/shared/WFILES.H $
- //
- // 15 3/09/95 5:22p Rjohnson
- //
-
-